package com.gupaoedu.demo.serialize;

import com.alibaba.fastjson.JSON;

/**
 * <p>
 *
 * </p>
 *
 * @author Nicky
 * @since 2019-07-23
 */
public class FastJsonSerializer implements ISerialize {
    @Override
    public <T> byte[] serialize(T object) {
        return JSON.toJSONString(object).getBytes();
    }

    @Override
    public <T> T deserialize(byte[] bytes, Class<T> claz) {
        return JSON.parseObject(new String(bytes),claz);
    }
}
